#include "groupclientsdialog.h"
#include "clientbriefinfopanel.h"
#include "clientgroupcenter.h"
#include "common.h"

GroupClientsDialog::GroupClientsDialog()
{
	setupWidget();
}

void GroupClientsDialog::setupWidget()
{
	mainLayout = new QVBoxLayout;
	setLayout(mainLayout);

	m_ClientGroupCenter = g_DataCenter->createClientGroupCenter();
	ClientGroupCenter::Iterator it = m_ClientGroupCenter->findGroup(0);
	panel = new ClientBriefInfoPanel((*it),this);
	mainLayout->addWidget(panel);
}

void GroupClientsDialog::showGroupView(int groupId)
{
	if(panel != NULL)
	{
		mainLayout->removeWidget(panel);
		delete panel;
	}
	ClientGroupCenter::Iterator it = m_ClientGroupCenter->findGroup(groupId);
	panel =  new ClientBriefInfoPanel((*it),this);
	mainLayout->addWidget(panel);
}
